#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, X;
    cin >> N >> X;
    vector<int> diffs;
    for (int i = 0; i < N; ++i) {
        int num;
        cin >> num;
        diffs.push_back(abs(num - X));
    }

    int g = 0;
    for (int d : diffs) {
        g = __gcd(g, d);
    }

    cout<< g << '\n';

    return 0;
}